package com.zwh.common.utils.file;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@ConfigurationProperties(prefix = UploadProperties.PREFIX,ignoreInvalidFields=true)
public class UploadProperties {
    public static final String PREFIX = "web.sys.common.upload";

    /**最大文件大小**/
    private long maxFileSize=-1;

    /**
     * 后缀限制
     */
    private List<String> suffixLimit;
    private boolean doLimit=false;
    private String headerEncoding="UTF-8";
    // 文件保存目录绝对路径
    private String baseDir = "/temp/";
    // 文件的目录名
    private String dirName = "images";
    //private static final String TEMP_PATH = "/temp";
    /**
     * 上传文件临时保存路径
     * 阀值,默认超过 10M 的文件才会写到临时目录,否则在内存中
     */
    private String tempPath;
    // 若不指定则文件名默认为 yyyyMMddHHmmss_xyz
    private String fileName;
    // 文件保存目录路径
    private String savePath;
    // 文件保存目录url
    private String saveUrl;

    public long getMaxFileSize() {
        return maxFileSize;
    }

    public void setMaxFileSize(long maxFileSize) {
        this.maxFileSize = maxFileSize;
    }

    public List<String> getSuffixLimit() {
        return suffixLimit;
    }

    public void setSuffixLimit(List<String> suffixLimit) {
        this.suffixLimit = suffixLimit;
    }

    public boolean isDoLimit() {
        return doLimit;
    }

    public void setDoLimit(boolean doLimit) {
        this.doLimit = doLimit;
    }

    public String getBaseDir() {
        return baseDir;
    }

    public void setBaseDir(String baseDir) {
        this.baseDir = baseDir;
    }

    public String getDirName() {
        return dirName;
    }

    public void setDirName(String dirName) {
        this.dirName = dirName;
    }

    public  String getTempPath() {
        return tempPath;
    }

    public void setTempPath(String tempPath) {
        this.tempPath = tempPath;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getSavePath() {
        return savePath;
    }

    public void setSavePath(String savePath) {
        this.savePath = savePath;
    }

    public String getSaveUrl() {
        return saveUrl;
    }

    public void setSaveUrl(String saveUrl) {
        this.saveUrl = saveUrl;
    }

    public String getHeaderEncoding() {
        return headerEncoding;
    }

    public void setHeaderEncoding(String headerEncoding) {
        this.headerEncoding = headerEncoding;
    }
}
